package top.shiyiri.shops.controller;

import top.shiyiri.shops.bean.Admins;
import top.shiyiri.shops.service.AdminsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author Aunean
 * @date 2021/12/21
 */
@Controller
public class AdminsController {

    @Autowired
    private AdminsService adminsService;

    @RequestMapping("/login")
    public String login(String name, String pass) {
        System.out.println(name + "\t" + pass);
        Admins login = adminsService.login(name, pass);
        System.out.println(login);
        if (login != null) {
            return "redirect:main.jsp";
        } else {
            return "redirect:index.html";
        }

    }
}
